home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / comm / yep16.zip / YX-13.ZIP / K.CMD < prev    next >
OS/2 REXX Batch file  |  1996-11-20  |  3KB  |  117 lines

  1. /*
  2.  
  3.  Sparkles!
  4.  
  5.  Another Useless REXX by Tim Middleton (as544@torfree.net)
  6.  
  7. */
  8.  
  9. delay  = 0
  10. Height = 25
  11. Width  = 80
  12.  
  13. /***************************************************************************/
  14.  
  15. chrs = '≈°°°++oO**÷÷∞∙··∙·=∙·∙·■≡Φ....@'
  16. bkch = '∙···∙·∙..°°÷+'
  17.  
  18. /* foreground colours */
  19. Black  = D2C(27)||'[30m'; Red   = D2C(27)||'[31m'; Green   = D2C(27)||'[32m';
  20. Yellow = D2C(27)||'[33m'; Blue  = D2C(27)||'[34m'; Magenta = D2C(27)||'[35m';
  21. Cyan   = D2C(27)||'[36m'; White = D2C(27)||'[37m';
  22.  
  23. /* background colours */
  24. bgBlack  = D2C(27)||'[40m'; bgRed     = D2C(27)||'[41m';
  25. bgGreen  = D2C(27)||'[42m'; bgYellow  = D2C(27)||'[43m';
  26. bgBlue   = D2C(27)||'[44m'; bgMagenta = D2C(27)||'[45m';
  27. bgCyan   = D2C(27)||'[46m'; bgWhite   = D2C(27)||'[47m';
  28.  
  29. /* colour attributes (note: NORMAL resets everything to gray on black) */
  30. Normal = D2C(27)||'[0m'; Bright = D2C(27)||'[1m';Blink  = D2C(27)||'[5m';
  31.  
  32. /* cursor position (see fuctions way down at the end) */
  33. SavePos  = D2C(27)||'[s'; RestorePos = D2C(27)||'[u';
  34.  
  35. /* ansi clear screen (change colour first to change screen colour) */
  36. AnsiClear  = D2C(27)||'[2J'; 
  37.  
  38. /* erase from current position to end of current screen line */
  39. ClearEOL = D2C(27)||'[K';
  40.  
  41. call rxFuncAdd 'syssleep', 'rexxutil', 'syssleep'
  42.  
  43. signal on novalue
  44. signal on halt
  45.  
  46. chrs = left(chrs,length(chrs) * 4 - length(bkch))||bkch
  47. nchrs = length(chrs)
  48. if height // 2 = 0 then height = height - 1
  49. mx = (width+2) % 2
  50. my = (height+2) % 2
  51.  
  52. clr.0 = 12
  53. clr.1 = normal||cyan
  54. clr.2 = normal||blue
  55. clr.3 = normal||white
  56. clr.4 = bright||white
  57. clr.5 = bright||yellow
  58. clr.6 = normal||red
  59. clr.7 = bright||black
  60. clr.8 = bright||blue
  61. clr.9 = bright||cyan
  62. clr.10= normal||white
  63. clr.11= normal||cyan
  64. clr.12= normal||blue
  65.  
  66. ret = charout(,ansiclear)
  67. ret = charout(,ansi_xy(1,height+1)||bgBlue||bright||blue||' Sparkles!'||cleareol);
  68. ret = charout(,bgBlack);
  69.  
  70. do forever
  71.     cl = random(1,clr.0)
  72.     ax = random(0,mx-1)
  73.     ay = random(0,my-1)
  74.     ac = random(1,nchrs)
  75.     ret = charout(,ansi_xy(mx+ax,my+ay)||clr.cl||substr(chrs,ac,1))
  76.     ret = charout(,ansi_xy(mx-ax,my-ay)||clr.cl||substr(chrs,ac,1))
  77.     ret = charout(,ansi_xy(mx+ax,my-ay)||clr.cl||substr(chrs,ac,1))
  78.     ret = charout(,ansi_xy(mx-ax,my+ay)||clr.cl||substr(chrs,ac,1))
  79.     ret = charout(,ansi_xy(72,height+1)||bgBlue||bright||blue||time()||bgBlack)
  80.     call syssleep delay;
  81. end
  82.  
  83.  
  84. EXIT
  85.  
  86. /* position cursor where ansi_xy(1,1) is top left of screen */
  87. ansi_xy : procedure
  88. x = arg(1) - 1;
  89. y = arg(2) - 1;
  90. return D2C(27)||'['||y||';'||x||'H';
  91.  
  92.  
  93. /* cursor moves - AnsiUp() moves up one line. AnsiUp(10) moves up 10 lines */
  94. AnsiUp : Procedure
  95. x = arg(1);
  96. return D2C(27)'['||x||'A'; 
  97.  
  98. AnsiDown : Procedure
  99. x = arg(1);
  100. return D2C(27)'['||x||'B'; 
  101.  
  102. AnsiRight : Procedure
  103. x = arg(1);
  104. return D2C(27)'['||x||'C'; 
  105.  
  106. AnsiLeft  : Procedure
  107. x = arg(1);
  108. return D2C(27)'['||x||'D'; 
  109.  
  110. halt:
  111.     /* ret = charout(,D2C(27)||'[0;'||height-1||'H'||bgblack||normal||white); */
  112.     /* ret = charout(,ansi_xy(1,height)||bgblack||normal||white); */
  113.     ret = charout(,D2C(27)||'['||(height-1)||';'||0||'H'||bgblack||normal||white);
  114.     exit
  115.     
  116.  
  117.